
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>文字统计器</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            line-height: 1.6;
            padding: 20px;
            background-color: #f4f4f9;
        }
        h1 {
            color: #333;
        }
        textarea {
            width: 100%;
            height: 150px;
            padding: 10px;
            border: 1px solid #ccc;
            border-radius: 4px;
            resize: vertical;
            font-size: 16px;
        }
        button {
            display: inline-block;
            padding: 10px 15px;
            margin-top: 10px;
            font-size: 16px;
            background-color: #007bff;
            color: #fff;
            border: none;
            border-radius: 4px;
            cursor: pointer;
        }
        button:hover {
            background-color: #0056b3;
        }
        #wordCount {
            margin-top: 15px;
            font-size: 18px;
        }
    </style>
</head>
<body>

    <h1>文字统计器</h1>
    <textarea id="textInput" placeholder="请输入文本..."></textarea>
    <button onclick="countWords()">统计字数</button>
    <p id="wordCount">字数: 0</p>

    <script>
        function countWords() {
            var text = document.getElementById('textInput').value;
            var wordCount = text.length;
            document.getElementById('wordCount').innerText = '字数: ' + wordCount;
        }
    </script>

</body>
</html>
